package com.water.app.Impl.shopping;

import com.water.app.address;
import com.water.app.interfaces.shopping.addressService;
import com.water.app.mapper.addressMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class addressServiceImpl implements addressService {
    @Autowired
    private addressMapper addressMapper;
    @Override
    public List<address> selectAddressByUserId(Integer userId) {
        return addressMapper.selectAddressByUserId(userId);
    }

    @Override
    public boolean reviseAddress(address address, Integer userId) {
        return addressMapper.reviseAddress(address,userId);
    }

    @Override
    public boolean insertAddress(String address, int userId,String email,String name) {
        return addressMapper.insertAddress(address,userId,email,name)>0;
    }

    @Override
    public boolean deleteById(int id) {
        return addressMapper.deleteById(id)>0;
    }

    @Override
    public Integer selectAddressNumberByUserId(int userId) {
        return addressMapper.selectAddressNumberByUserId(userId);
    }
}
